package com.mediacloud.app.newsmodule.activity.video

import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.chinamcloud.audioserver.APSLifecycleKit
import com.eventTrack.CDPTrackReportManager
import com.eventTrack.TXReportManager
import com.facebook.drawee.view.SimpleDraweeView
import com.mediacloud.app.assembly.util.loadByFresco
import com.mediacloud.app.model.news.ArticleItem
import com.mediacloud.app.newsmodule.R
import com.tencent.liteav.demo.superplayer.model.entity.VideoAlbumNew

class VideoAlbumProgramAdapter :
    BaseQuickAdapter<VideoAlbumNew, BaseViewHolder>(R.layout.item_video_album_list) {
    var playingPositionTV: TextView? = null
    var apsKit: APSLifecycleKit? = null
    var playPosition = 0
    override fun convert(helper: BaseViewHolder, item: VideoAlbumNew?) {
        val titleTv = helper.getView<TextView>(R.id.tvTitle)
        val logo = helper.getView<SimpleDraweeView>(R.id.videoLogo)
        val tvSacn = helper.getView<TextView>(R.id.tvSacn)
        val tvTime = helper.getView<TextView>(R.id.tvTime)

        item?.let{
            titleTv.text = it.title
            logo.loadByFresco(it.logo)
            tvSacn.text = "${it.gethitCount()}"
            tvTime.text = it.publishDate
            val articleItem = ArticleItem()
            articleItem.id = item.id.toLong()
            articleItem.title = item.title
            articleItem.logo=item.logo
            articleItem.publishDate = item.publishDate
            articleItem.publishdate = item.publishDate
            //articleItem.Author = item.
            articleItem.publishdate_format = item.publishDate
            if (TXReportManager.getInstance().firstTabInfo.tabName == "视听") {
                CDPTrackReportManager.getInstance()
                    .ShortVideoExpose( articleItem, helper.absoluteAdapterPosition)
            }
        }


    }

}